package com.feicheng.house.wcpay.serviceImpl;


import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSON;
import com.feicheng.house.entity.BuyOrder;
import com.feicheng.house.entity.DepositRecordClientUserVo;
import com.feicheng.house.result.ResultInfo;
import com.feicheng.house.service.IBuyOrderClientShopVoService;
import com.feicheng.house.service.impl.BuyOrderClientShopVoServiceImpl;
import com.feicheng.house.wcpay.service.PayCallbackService;

import pojo.WxPayNotify;

@Service
public class PayCallbackServiceImpl implements PayCallbackService {
	
	@Autowired
	private IBuyOrderClientShopVoService iBuyOrderClientShopVoService;
	
	
	@Override
	public String result(WxPayNotify wxPayNotify) {
		Map<String, Object> map = new HashMap<String, Object>();
		 Integer paymentItemId = Integer.parseInt(wxPayNotify.getAttach());
		 Map<String,String> result = new HashMap<>();
	        if("SUCCESS".equals(wxPayNotify.getReturn_code())){
	            result.put("code", "SUCCESS");
	            result.put("message","OK");
	           // studentOpenService.repayment(paymentItemId,param.getTransaction_id());
	        }
	        BuyOrder buyOrder = new BuyOrder();
	        
	       if (wxPayNotify.getOut_trade_no().equals(buyOrder.getBuyOrderNumber())) {
	    	   wxPayNotify.setAttach("订单");
		}
	       DepositRecordClientUserVo depositRecordClientUserVo = new DepositRecordClientUserVo();
	       if (wxPayNotify.getOut_trade_no().equals(depositRecordClientUserVo.getDepositNumber())) {
	    	   wxPayNotify.setAttach("押金");
			
		}
		return JSON.toJSONString(map);
	}

}
